home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
v10n12.arc
/
QUARTER.DBF
< prev
next >
Wrap
Text File
|
1991-05-30
|
806b
|
28 lines
* Technique to compute any quarter of year based on input from user.
* Adjust the string of numbers to fit quarter arrangement. Replace
* QTR or MNTH with your field name. The variable QTR is returned as
* string data. If a numeric variable is needed use: VAL(qtr)
* or use the system date as in the following:
* qtr = VAL(SUBSTR("111222333444",MONTH(DATE()),1)
* dBASE III Plus tested.
SET TALK OFF
CLEAR
mnth = 0
@ 10,10 SAY "Enter month to translate: " GET mnth RANGE 1,12
READ
* Here is one-liner number 1
qtr = SUBSTR("111222333444",mnth,1)
* Here is one-liner number 2
qtrsufx = SUBSTR("--st-nd-rd-th",VAL(qtr)*3,2)
* Here is the results
@ 12,10 SAY "Month "+ LTRIM(STR(mnth))+" is the " + qtr + qtrsufx +;
" quarter."
RELEASE mnth, qtr, qtrsufx
SET TALK ON
RETURN